package com.zd.commodity.productMng.dao.impl;

import javax.annotation.Resource;

import org.apache.xmlbeans.impl.xb.xsdschema.RestrictionDocument.Restriction;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.zd.commodity.dao.impl.BaseDao;
import com.zd.commodity.productMng.dao.IProductIntroductionDao;
import com.zd.commodity.productMng.entity.ProductIntroduction;
@Repository
public class ProductIntroductionDao extends BaseDao<ProductIntroduction>
		implements IProductIntroductionDao {
	@Resource(name = "sessionFactory")
	public void setSuperSessionFactory(SessionFactory sessionFactory){
		super.setSessionFactory(sessionFactory);
	}

	@Override
	public DetachedCriteria getDetachedCriteria(ProductIntroduction t1,
			ProductIntroduction t2, Object param) {
		DetachedCriteria dc=DetachedCriteria.forClass(ProductIntroduction.class);
		if(t1!=null&&t1.getName().trim().length()>0){
			dc.add(Restrictions.like("name", t1.getName(),MatchMode.ANYWHERE));
		}
		return dc;
	}


}
